<template>
    <div>
        <a-modal v-model="show" title="审核" @ok="handleOk" @cancel="show = false">
            <a-radio-group v-model="form.status">
                <a-radio-button :value="3">
                    通过
                </a-radio-button>
                <a-radio-button :value="1">
                    不通过
                </a-radio-button>
            </a-radio-group>
        </a-modal>
    </div>
</template>
<script>
    import { message } from 'ant-design-vue';
    import { postHiddenAudit } from "@/services"
    export default {
        props: {
        },
        data() {
            return {
                // 是否显示弹框
                show: false,
                // 表单
                form: {
                    id: '',
                    status: '',
                },
            }
        },
        methods: {
            /**
             * 打开弹框
             */
            open(data) {
                this.show = true // 打开弹框
                this.form = this.$options.data().form // 初始化
                if (data?.id) {
                    this.form.id = data?.id
                }
            },
            /**
             * 确认提交
             */
            async handleOk() {
                let { form } = this
                if (form.status == '') {
                    return message.warning('请选择是否通过')
                }

                let res = await postHiddenAudit(this.form)
                if (res.code == 0) {
                    message.success('提交成功')
                } else {
                    return message.warning(res?.msg)
                }
                this.show = false
                this.$emit('ok', 1);
            }
        },
    }
</script>